<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateYsBarRolePermissionsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('bar_role_permissions', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('bar_role_id')->unsigned()->index()->comment('吧角色id');
			$table->integer('bar_permission_id')->unsigned()->index();


            $table->foreign('bar_role_id')->references('id')->on('bar_roles');
            $table->foreign('bar_permission_id')->references('id')->on('bar_permissions');

            $table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('bar_role_permissions');
	}

}
